﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="/js/header.js"></script>
    <script src="/lib/date/wdatepicker.js"></script>
</head>
<body>
    <div class="data-wrap case">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
            </div>
            <div class="pull-right">

                <form class="form-inline" id="formSearch" onsubmit="return false;">

                    <div class="input-group input-group-sm">
                        <div class="input-sm"><input name="autoRefresh" type="checkbox" title="10秒自动刷新" /> <label id="time" class="wd100">10秒自动刷新</label></div>
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">公司名称：</label>
                        <input class="form-control" id="companyName" name="companyName" type="text" autocomplete="off">
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">银行卡号：</label>
                        <input class="form-control" name="cardNumber" type="text" autocomplete="off">
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">用户名：</label>
                        <input class="form-control" name="cardName" type="text" autocomplete="off">
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">启用状态：</label>
                        <select class="form-control" name="enableStatus">
                            <option value="">请选择</option>
                            <option value="1">启用</option>
                            <option value="2">禁用</option>
                        </select>
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">更新时间：</label>
                        <select class="form-control" name="lastUpdateDateSortType">
                            <option value="">请选择</option>
                            <option value="2" selected>不正常</option>
                            <option value="1">正常</option>
                        </select>
                    </div>
                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>

        <div class="paging">
        </div>
    </div>

    <script type="text/x-dot-template" id="pgerTemplate">

        <div class="data-body data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th class="t_l wd100">公司名称</th>
                                <th class="t_l wd100">银行名称</th>
                                <th class="t_l wd125">银行卡号</th>
                                <th class="t_l wd100">用户名</th>
                                <th class="t_c wd75">使用状态</th>
                                <th class="t_c wd75">启用状态</th>
                                <th class="t_r wd75">参考余额</th>
                                <th class="t_l wd130">更新时间</th>
                                <th class="t_r wd100">中转费率(%)</th>
                                <th class="t_l wd150">虚拟机编码</th>
                                <th class="t_l">备注</th>
                                <th class="wd125">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{? it.tData && it.tData.length>0}}
                            {{~it.tData :item:index}}
                            <tr>
                                <td class="t_l wd100" title="{{= item.companyNameEn }}">{{= item.companyName }}</td>
                                <td class="t_l wd100" title="{{= item.bankName }}">{{= item.bankName }}</td>
                                <td class="t_l wd125" title="{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}">{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}</td>
                                <td class="t_l wd100">{{= item.cardName }}</td>
                                <td class="t_c wd75">

                                    {{?  item.usingStatus}}
                                    {{? item.usingStatus==1 }}
                                    <span class="green bold">有效</span>
                                    {{?? }}
                                    <span class="red bold">冻结</span>
                                    {{? }}
                                    {{??}}

                                    {{?}}
                                </td>
                                <td class="t_c wd75">

                                    {{?  item.usingStatus}}
                                    {{? item.enableStatus==1 }}
                                    <span class="green bold">启用</span>
                                    {{?? item.enableStatus==2}}
                                    <span class="red bold">禁用</span>
                                    {{??}}
                                    <span class="red bold">删除</span>
                                    {{? }}
                                    {{??}}

                                    {{?}}
                                </td>
                                <td class="t_r bold wd75">{{?  item.balance}}{{= item.balance }}{{??}}{{?}}</td>
                                <td class="wd130" {{= (item.timeDifference>=300 && item.enableStatus==1)? "style=\"background-color:red;color:white\"":"" }}>
                                    {{?  item.balanceLastUpdate}}{{= item.balanceLastUpdate }}{{??}}{{?}}
                                </td>
                                <td class="t_r wd100">
                                    {{?  item.depositFeeRatio}}{{= item.depositFeeRatio }}(%){{??}}0.00(%){{?}}
                                </td>
                                <td class="t_l wd150" title="{{= item.vmClientId==null?"":item.vmClientId }}">
                                    {{?  item.vmClientId}}{{= item.vmClientId }}{{??}}{{?}}
                                </td>
                                <td class="t_l wd100" title="{{= item.remark==null?"":item.remark }}">
                                    {{?  item.remark}}{{= item.remark }}{{??}}{{?}}
                                </td>
                                <td class="wd125">
                                    {{? item.enableStatus==1 }}
                                    <a class="btn btn-default btn-xs btn-warning" data-confirm=' "{{= item.cardName }}" <br>确定要<span class="orange">禁用</span>该银行卡？' data-href="/Transfer/TransferCardUpdateStatus?id={{= item.bcId}}&status=2">禁用</a>
                                    {{?? }}
                                    <a class="btn btn-default btn-xs btn-success" data-confirm=' "{{= item.cardName }}" <br>确定要<span class="orange">启用</span>该银行卡？' data-href="/Transfer/TransferCardUpdateStatus?id={{= item.bcId}}&status=1">启用</a>
                                    <button type="button" class="btn btn-default btn-xs" data-modal="/view/transfer/transfercardEdit.html?id={{= item.bcId}}" data-title="编辑 - {{= item.bankName }}-{{= item.cardName }}-{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}" data-width="452" data-height="120">
                                        <span class="glyphicon glyphicon-edit"></span> 编辑
                                    </button>
                                    {{? }}
                                </td>
                            </tr>
                            {{~}}
                            {{??}}
                            <tr class="noRecord">
                                <td colspan="12">暂无记录！</td>
                            </tr>
                            {{?}}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>
    <script type="text/javascript">

        var wait = 10;

        var autoRefresh = $("input[name='autoRefresh']");

        $(function () {

            FlashPay.UI.DataAutoHeight();

            $("#btnSearch").click(function () {
                
                window.currentPage = null;

                doSearch();
            });

            FlashPay.UI.DoSearch();

            $(autoRefresh).change(function () {
                wait = 10;
                time();
            });
        });

        //倒时计
        function time() {
            var obj = document.getElementById("time");

            var isauto = $(autoRefresh).is(':checked');
            if (!isauto) {

                obj.innerText = "10秒自动刷新";

                return false;
            }

            if (wait == 0) {
                obj.innerText = "10秒自动刷新";
                wait = 10;

                if (isauto) {
                    setTimeout(function () { time(); }, 1000);
                }

                FlashPay.UI.DoSearch();
            } else {
                obj.innerText = wait + "秒自动刷新";
                wait--;
                setTimeout(function () { time(); }, 1000);
            }
        }

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                FlashPay.UI.DoSearch();
            }
        });

        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function doSearch() {
            emptyCompanyId();
            FlashPay.UI.Pager(".paging", { templateId: "pgerTemplate", pageSize: 15, ajax: { url: '/Transfer/TransferCard' } });
        }
        
        function emptyCompanyId() {

            var company = $("#company").val();;

            if (FlashPay.Util.isNullOrEmptySpance(company)) {
                $("input[name='companyId']").val("");
            }
        }
    </script>
</body>
</html>